<%@ page contentType="text/html;charset=UTF-8" language="java" %>
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
        <html lang="zh">

        <head>
            <meta charset="UTF-8">
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <title>修改密码</title>
            <link rel="shortcut icon" href="img/library.ico" />
            <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css">
            <script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js"></script>
            <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
            <style>
                body {
                    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
                    background-image: url('img/passward_bg.jpg');
                    background-size: cover;
                    background-position: center center;
                    background-attachment: fixed;
                    min-height: 100vh;
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    margin: 0;
                    padding: 20px;
                }

                .password-container {
                    background-color: rgba(255, 255, 255, 0.9);
                    padding: 30px;
                    border-radius: 15px;
                    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
                    width: 100%;
                    max-width: 500px;
                }

                .page-title {
                    text-align: center;
                    margin-bottom: 30px;
                    color: #333;
                }

                .page-title h1 {
                    font-size: 2.2rem;
                    margin-bottom: 10px;
                    position: relative;
                    display: inline-block;
                }

                .page-title h1::after {
                    content: '';
                    position: absolute;
                    bottom: -10px;
                    left: 50%;
                    transform: translateX(-50%);
                    width: 80px;
                    height: 3px;
                    background: #3498db;
                    border-radius: 2px;
                }

                .form-group {
                    margin-bottom: 20px;
                }

                .form-label {
                    font-weight: 500;
                    color: #333;
                    margin-bottom: 8px;
                }

                .form-control {
                    border-radius: 8px;
                    padding: 12px;
                    border: 1px solid #ddd;
                    transition: all 0.3s ease;
                }

                .form-control:focus {
                    border-color: #3498db;
                    box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.25);
                }

                .btn-primary {
                    background-color: #3498db;
                    border-color: #3498db;
                    padding: 12px 30px;
                    font-weight: 500;
                    border-radius: 8px;
                    width: 100%;
                    margin-top: 10px;
                }

                .btn-primary:hover {
                    background-color: #2980b9;
                    border-color: #2980b9;
                }

                .alert {
                    border-radius: 8px;
                    margin-bottom: 20px;
                }

                .alert-dismissible .btn-close {
                    padding: 1.25rem;
                }
            </style>
        </head>

        <body>
            <div class="password-container">
                <div class="page-title">
                    <h1>修改密码</h1>
                </div>

                <c:if test="${!empty succ}">
                    <div class="alert alert-success alert-dismissible fade show" role="alert">
                        ${succ}
                        <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
                    </div>
                </c:if>
                <c:if test="${!empty error}">
                    <div class="alert alert-danger alert-dismissible fade show" role="alert">
                        ${error}
                        <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
                    </div>
                </c:if>

                <form action="reader_repasswd_do.html" method="post" id="repasswd">
                    <div class="form-group">
                        <label for="oldPasswd" class="form-label">原密码</label>
                        <input type="password" class="form-control" id="oldPasswd" name="oldPasswd" required>
                    </div>
                    <div class="form-group">
                        <label for="newPasswd" class="form-label">新密码</label>
                        <input type="password" class="form-control" id="newPasswd" name="newPasswd" required>
                    </div>
                    <div class="form-group">
                        <label for="reNewPasswd" class="form-label">确认新密码</label>
                        <input type="password" class="form-control" id="reNewPasswd" name="reNewPasswd" required>
                    </div>
                    <button type="submit" class="btn btn-primary">确认修改</button>
                </form>
            </div>

            <script>
                $(document).ready(function () {
                    $("#repasswd").submit(function () {
                        var newPasswd = $("#newPasswd").val();
                        var reNewPasswd = $("#reNewPasswd").val();
                        if (newPasswd !== reNewPasswd) {
                            alert("两次输入的新密码不同！");
                            return false;
                        }
                        return true;
                    });
                });
            </script>
        </body>

        </html>